<?
$ltiList = getLtisByLeague($leagueId);
?>
<script>
var counter = 0;
function submitCheckLtis() {
	result = "";
	for (i = 1; i <= counter; i++) {
		if (document.getElementById("L" + i) != null && document.getElementById("L" + i).checked) {
			if (result != "") {
				result += ",";
			}
			result += document.getElementById("L" + i).value;
		}
	}
	
	//document.getElementById('checkReturnedLtiForm').elements["ltiList"].value = result;
	//document.getElementById('checkReturnedLtiForm').submit();
	document.location.href = "../admin/submitCheckReturnedLtis.php?ltiList=" + result;
}
</script>
<table border='1'><tr><td valign='top' colspan="3"><h2>All Open Lti/Spuds</h2></td></tr>
<?	
	$count = count($ltiList);
	$j = 1;
	for ($i = 0; $i < $count; $i++) {?>
		<tr><td><?echo getLtiString($ltiList[$i]) ?></td><td><?echo $ltiList[$i]->ltiState ?></td>
		<td>
		<?if ($ltiList[$i]->ltiState != LtiState::Closed) { $j++;?><input type="checkbox" id="L<?echo $i?>" value="<?echo $ltiList[$i]->id?>"><?}?></td></tr>
	<?}?>
	<tr>
		<td colspan="3"><input type="button" value="Submit" onclick="submitCheckLtis()">
	</tr>
</table>
<script>counter = <?echo $j?></script>
<form method="post" id="checkReturnedLtiForm" action="../admin/submitCheckReturnedLtis.php">
<input type="hidden" name="ltiList">
</form>